circuit Arbiters :
  module Arbiter :
    input clock : Clock
    input reset : Reset
    output io : { flip in : { flip ready : UInt<1>, valid : UInt<1>, bits : UInt<8>}[2], out : { flip ready : UInt<1>, valid : UInt<1>, bits : UInt<8>}, chosen : UInt<1>}

    io.chosen <= UInt<1>("h1") @[Arbiter.scala 138:13]
    io.out.bits <= io.in[1].bits @[Arbiter.scala 139:15]
    when io.in[0].valid : @[Arbiter.scala 141:26]
      io.chosen <= UInt<1>("h0") @[Arbiter.scala 142:17]
      io.out.bits <= io.in[0].bits @[Arbiter.scala 143:19]
    node grant_1 = eq(io.in[0].valid, UInt<1>("h0")) @[Arbiter.scala 46:78]
    node _io_in_0_ready_T = and(UInt<1>("h1"), io.out.ready) @[Arbiter.scala 149:19]
    io.in[0].ready <= _io_in_0_ready_T @[Arbiter.scala 149:14]
    node _io_in_1_ready_T = and(grant_1, io.out.ready) @[Arbiter.scala 149:19]
    io.in[1].ready <= _io_in_1_ready_T @[Arbiter.scala 149:14]
    node _io_out_valid_T = eq(grant_1, UInt<1>("h0")) @[Arbiter.scala 150:19]
    node _io_out_valid_T_1 = or(_io_out_valid_T, io.in[1].valid) @[Arbiter.scala 150:31]
    io.out.valid <= _io_out_valid_T_1 @[Arbiter.scala 150:16]

  module Arbiters :
    input clock : Clock
    input reset : UInt<1>
    output io : { flip in : { flip ready : UInt<1>, valid : UInt<1>, bits : UInt<8>}[2], out : { flip ready : UInt<1>, valid : UInt<1>, bits : UInt<8>}}

    inst arbiter of Arbiter @[Arbiters.scala 14:23]
    arbiter.clock <= clock
    arbiter.reset <= reset
    arbiter.io.in <= io.in @[Arbiters.scala 15:17]
    io.out.bits <= arbiter.io.out.bits @[Arbiters.scala 16:10]
    io.out.valid <= arbiter.io.out.valid @[Arbiters.scala 16:10]
    arbiter.io.out.ready <= io.out.ready @[Arbiters.scala 16:10]

